package models.cms;

import models.sys.User;
import play.db.jpa.Model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.util.Date;
import java.util.List;

/**
 * Created by sam on 16-2-13.
 */
@Entity(name = "t_comment")
public class Comment extends Model {
    @ManyToOne
    public User user;
    public Date created_at;
    @Column(length = 1024)
    public String content;
    @ManyToOne
    public Post to_post;
    @ManyToOne
    public Comment to_comment;

    public List<Comment> load_comments() {
        return Comment.find("to_comment = ?", this).fetch();
    }
}
